Skip to content

[Entity Store] Add more granular distributions#352

Merged
romulets merged 3 commits intomainfrom
entity-store/distribution-modes
Apr 10, 2026
Merged

[Entity Store] Add more granular distributions#352
romulets merged 3 commits intomainfrom
entity-store/distribution-modes

Conversation

@romulets
Copy link
Copy Markdown
Member

@romulets romulets commented Apr 7, 2026

Extends the entity_store_perf workflow with explicit entity mix controls, optional metrics collection during single-file upload, aligns generated document shape with generic-only ECS entity, and updates Entity Store V2 install to use the public Kibana API path and version.

Functional changes

create-perf-data

  • --distribution absolute: You can fix exact counts per entity type with --user-count, --host-count, --service-count, and --generic-count. All four are required, must be non-negative integers, and must sum exactly to <entity-count>.
  • Preset distributions unchanged in intent: equal (25% each type, remainder to service) and standard (≈33% user/host/generic, ~1% service) still work; the --*-count flags are rejected unless distribution is absolute.
  • Generated documents: The top-level entity object is emitted only for generic entities. User, host, and service documents rely on their respective ECS fields (user, host, service) without a duplicate top-level entity block. Type definitions in src/types/entities.ts match this shape.

upload-perf-data

  • --metrics: While uploading, periodically writes the same style of metrics logs under ./logs as interval mode (cluster health, node stats, Kibana stats; transform stats when not in --noTransforms mode).
  • --samplingInterval <seconds>: Metrics sampling period when --metrics is on (default: 5).
  • --transformTimeout <minutes>: In metrics mode with transforms (V1 flow), waits up to this long for the generic transform to catch up to the uploaded document count before finishing; logs a warning and continues on timeout (default: 30).
  • --noTransforms: Transform polling is skipped in metrics mode (V2 / ESQL path unchanged in spirit).

Cleanup of metrics loggers is done in a finally block so intervals stop even if upload or counting fails.

Entity Store V2 install (Kibana)

  • Install URL updated from /internal/security/entity_store/install to /api/security/entity_store/install.
  • Install request uses the public v1 API version header (no apiVersion=2 query param on the path).

@romulets romulets requested a review from a team as a code owner April 7, 2026 14:35
@romulets romulets requested review from Copilot and ymao1 April 7, 2026 14:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends the entity_store_perf tooling to support more controllable entity-type mixes when generating perf data, adds optional metrics sampling during single-file uploads, aligns generated document shape so only generic entities emit a top-level ECS entity object, and updates the Entity Store V2 install call to use the public Kibana API path/version.

Changes:

  • Add --distribution absolute plus --{user,host,service,generic}-count flags and validation plumbing for perf data generation.
  • Add --metrics, --samplingInterval, and --transformTimeout to upload-perf-data, with periodic cluster/node/Kibana (and optionally transform) metrics logging and finally cleanup.
  • Switch Entity Store V2 install to /api/security/entity_store/install and use the public v1 API version header; adjust entity types/docs to be generic-only for top-level entity.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/utils/kibana_api.ts Updates Entity Store V2 install to public path and public API version header.
src/constants.ts Changes the Entity Store V2 install URL constant to the public /api/... endpoint.
src/types/entities.ts Updates entity document TS types so only generic entities have top-level entity.
src/commands/entity_store_perf/README.md Documents new distribution options and upload metrics flags.
src/commands/entity_store_perf/index.ts Wires new CLI flags for absolute distribution and upload metrics options.
src/commands/entity_store_perf/entity_store_perf.ts Implements explicit-count distribution validation, generic-only entity shape, and metrics-mode logging + transform wait during upload.

@romulets romulets merged commit 6907dd0 into main Apr 10, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants